package net.protocol.diameter;

import java.util.HashMap;
import java.util.Map;

/**
 * <pre>
 * For all IETF standards track Diameter applications,the vendor id is zero.
 * List of the defined Diameter interfaces in the IETF, 3GPP, 3GPP2, ETSI TISPAN, PacketCable, MSF and ITU standard bodies:
 *
 *  #Interface             #Network Location                   #Supported version
 *
 *  Diameter Base Protocol                                     IETF RFC 6733
 *  Diameter Commands for 3GPP                                 IETF RFC 3589
 *  Diameter Credit Control App                                IETF RFC 4006
 *  NASREQ Support for Network Access Server                   IETF RFC 4005
 *  EAP Support for Extensible Authentication Protocol         IETF RFC 4072
 *  Mobile IPv4 Support for Diameter Mobile IPv4               IETF RFC 4004
 *  Diameter Mobile IPv6                                       IETF RFC 5447
 *  Diameter SIP Application                                   IETF RFC 4740
 *  Sh interface           Between AS and HSS                  3GGP TS 29.328 & TS 29.329
 *  Dh interface           Between AS and SLF                  3GGP TS 29.328 & TS 29.329
 *  Rf interface           Between AS and OFCS                 RFC 4006, 3GGP TS 32.225 & TS 32.299
 *  Ro interface           Between AS and OCS                  RFC 4006, 3GGP TS 32.225 & TS 32.299
 *  Re interface           Between OCF and Rating function     3GPP TS 32.296
 *  Cx interface           Between CSCF and HSS                3GPP TS 29.228 & TS29.229
 *  Dx interface           Between CSCF and SLF                3GPP TS 29.228 & TS29.229
 *  Sp interface           Between PCRF and SPR                3GPP TS 23.203, TS 29.328 & TS 29.329
 *  Rx interface           Between AF and the PCRF             3GPP TS 23.203 & TS 29.214
 *  Rx+ interface          Rx reference point for EPC          3GPP TS 32820, 3GPP TS 23.203 & TS 29.214
 *  Gx interface           Between PCEF and the PCRF           3GPP TS 29.212 & TS 23.203
 *  Gy interface           Between OCS and PCEF                3GPP TS 32.29, TS 32.251 & RFC 4006
 *  Gz interface           Between PCEF and OFCS               3GPP TS 32.240, TS 32.295
 *  Gq interface           Between AF and PDF                  3GPP TS 29.209
 *  Gi interface           Between Packet Domain and an        3GPP TS 29.061
 *                             External packet data network
 *  SGi interface          Between the EPC based PLMN and      3GPP TS 29.061
 *                             The packet data network
 *  Zh interface           Between BSF and HSS                 3GPP TS 29.109 & TS 33.220
 *  Zh interface           Between BSF and HSS                 3GPP TS 29.109 & TS 33.220
 *                           	(used between operators)
 *  Dz interface           Between BSF and SLF                 3GPP TS 29.109 & TS 33.220
 *  Zn interface           Between BSF and NAF                 3GPP TS 29.109 & TS 33.220
 *  Zn' interface          Between BSF and Zn Proxy            3GPP TS 29.109 & TS 33.220
 *  Dw interface           Between the 3GPP AAA Server         3GPP TS 29.234
 *                           	and an SLF
 *  Wa interface           Between the WLAN AN and             3GPP TS 29.234
 *                           	the 3GPP AAA Proxy
 *  Wd interface           Between the 3GPP AAA Proxy and      3GPP TS 29.234
 *                           	3GPP AAA Server
 *  Wx interface           Between the 3GPP AAA Server         3GPP TS 29.234
 *                             and the HSS
 *  Wm interface           Between the 3GPP AAA Server         3GPP TS 29.234
 *                             and the PDG
 *  Wg interface           Between the 3GPP AAA Server/Proxy   3GPP TS 29.234
 *                             and the WAG
 *  Pr interface           Between the 3GPP AAA Server         3GPP TS 29.234
 *                             and the PNA
 *  Gmb interface          Between GGSN and BM-SC              3GPP TS 29.061
 *  Mz interface           Mz is the roaming variant of        3GPP TS 29.061
 *                             the Gmb reference point with
 *                             the same functionality
 *  Bi interface           CCF to BS                           3GPP TS TS 32.225
 *  MM10 interface         Multimedia Messaging Service        OMA MM10 interface
 *  Ty interface           Between AGW and PCRF                3GPP2 TSG-X X.S0013-014
 *  Tx interface           Between AF and PCRF                 3GPP2 TSG-X X.S0013-013
 *  S6a interface          Between MME and HSS                 3GPP TS 29.272
 *  S6b interface          Between the 3GPP AAA Server/Proxy   3GPP TS 23402
 *                             and the PDN GW
 *  S6d interface          Between MME and HSS                 3GPP TS 29.272
 *  S7c interface          Transfer of (QoS) policy            3GPP TS 32820, TS 23402
 *                             information from PCRF
 *                             to the S-GW.
 *  S9 interface           Between PCRF in the HPLMN (H PCRF)  3GPP TS 23.203 & TS 29.215
 *                             and a PCRF in the VPLMN (V PCRF)
 *  S13 interface          Between MME and EIR                 3GPP TS 29.272
 *  Gxa interface          PCRF and the BBERF                  3GPP TS 23.203
 *  Gxb interface          Between ePDG and vPCRF              3GPP TS 23.203
 *  Gxc interface          PCRF and the BBERF                  3GPP TS 23.203
 *  SWa interface          Between an un-trusted non-3GPP      3GPP TS 23402
 *                             IP access and
 *                             the 3GPP AAA Server/Proxy
 *  SWd interface          Between the 3GPP AAA Proxy          3GPP TS 23402
 *                             and 3GPP AAA Server
 *  SWn interface          Between Untrusted Non-3GPP          3GPP TS 23402
 *                             IP Access and ePDG
 *  SWm interface          Between the 3GPP AAA Server/Proxy   3GPP TS 23402
 *                             and the ePDG
 *  SWx interface          Between the 3GPP AAA Server         3GPP TS 23402
 *                             and the HSS
 *  Sta interface          Between a trusted non-3GPP IP       3GPP TS 23402
 *                             access and the
 *                             3GPP AAA Server/Proxy
 *  H2 interface           Between the 3GPP AAA Server         3GPP TS 23402
 *                             and the HA
 *  Gq' interface          Between AF and RACS                 ETSI TS 183.017
 *  E2 interface           Between AF and NASS                 ETSI TS 283 035
 *  E4 interface           Between NASS and RACS               ETSI TS 283 034
 *  E5 interface           Between UAAF-UAAF                   ETSI TS 282 004
 *  Re interface           Between RCEF and RACS               ETSI TS 183 060
 *  A3 interface           Between UAAF and AMF                ETSI TS 282 004
 *  A4 interface           Between CLF and UAAF                ETSI TS 282 004
 *  Rr interface           X-RACF                              03196-NGN-R3
 *  Zh interface           Generic Authentication              PKT-SP-29.109
 *                             Architecture (GAA)
 *  Zn interface           Generic Authentication              PKT-SP-29.109
 *                             Architecture (GAA)
 *  Cx interface           CSCF- HSS                           PKT-SP-29.229
 *  Dx interface           CSCF- SLF                           PKT-SP-29.229
 *  Pkt-laes-2 interface   Session Control Element-DF          PKT-SP-ES-INF-I01
 *                             (electronic surveillance requirements)
 *  P-CSCF- PAM Interface  Between P-CSCF-PAM                  PKT-SP-QOS-I02-080425,3GPP TS 23.203 & TS 29.214
 *  Pkt-mm-2 interface     Policy Server-CMTS                  3GPP TS 29.212 & TS 23.203
 *  TC-6                   Based on 3GPP Rx                    MSF-IA-DIAMETER.010-FINAL
 *  TC-7                   Based on 3GPP Ty                    MSF-IA-DIAMETER.014-FINAL
 *  TC-8                   Based on 3GPP Tx                    MSF-IA-DIAMETER.013-FINAL
 *  TC-9                   Based on 3GPP Rq                    MSF-IA-DIAMETER.005-FINAL
 *  TC-10                  Based on 3GPP Gx                    MSF-IA-DIAMETER.012-FINAL
 *  TC-11                  Based on 3GPP e4                    MSF-OA-DIMATER.011-FINAL
 *  DB-0                   Based on 3GPP Cx/Dx                 MSF-IA-DIAMETER.006-FINAL
 *  DB-2                   Based on 3GPP Sh/Dh                 MSF-IA-DIAMETER.003-FINAL
 *  BI-1                   Based on 3GPP Rf                    MSF-IA-BILLING.001-FINAL
 *  LOC-1                  Based on 3GPP e2                    MSF-IA.DIAMETER.008-FINAL
 *  Rw interface           Between the Policy Decision         ITU Q.3303.3
 *                             Physical Entity (PD-PE) and
 *                             the Policy Enforcement
 *                             Physical Entity (PE-PE)
 *  Rs interface           Between Service Control Physical    ITU Q.3301
 *                             Entity (SC-PE) and Resource
 *                             and Admission Control
 *                             Physical Entity (RAC-PE)
 * </pre>
 *
 * @author jinhongw@gmail.com
 */
public enum Standard {
	Base(0, 0),
	NASREQ(1, 0),

	CC(4, 0),
	Gx(16777238, 10415),
	Sh(16777217, 10415),
	Sd(16777303,10415),
	Rx(16777236, 10415),
	Gxx(16777266, 10415),
	
	MobileIPV4(2, 0),
	BaseAccounting(3, 0),
	EAP(5, 0),
	SIP(6, 0),
	Relay(0xFFFFFFFF, 0),
	Cx(16777216, 10415),
	Gmb(16777223, 10415),
	MM10(16777226, 10415),
	Gi(1, 10415),
	Rf(3, 10415),
	Ro(3, 10415),
	Ty(999999, 5535),
	OMNA(-1, -1);
	  
	public final int appId;
	public final int vendorId;

	private final static Map<Integer, Standard> KVS = new HashMap<Integer, Standard>();

	static {
		for (Standard e : values()) {
			KVS.put(e.appId, e);
		}
	}

	private Standard(int applicationId, int vendorId) {
		this.appId = applicationId;
		this.vendorId = vendorId;
	}

	/**
	 * @param appId
	 *            Application-ID
	 * @return Standard
	 */
	public static Standard valueOf(int appId) {
		return KVS.get(appId);
	}
}
